//
//  BaseModel.m
//  Wangi
//
//  Created by ChuXiang on 15/11/23.
//  Copyright © 2015年 ChuXiang. All rights reserved.
//

#import "BaseModel.h"
#import "SencondModel.h"
@implementation BaseModel
- (instancetype)initWithData:(NSDictionary *)data {
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:data];
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"ads"]) {
        NSArray *array = value;
        NSMutableArray *arr = [NSMutableArray arrayWithCapacity:0];
        for (NSDictionary *dic in array) {
            SencondModel *model = [[SencondModel alloc] initWithData:dic];
            [arr addObject:model];
        }
        self.adsArray = [[NSArray alloc] initWithArray:arr];
    }
}

- (id)valueForUndefinedKey:(NSString *)key {
    return nil;
}
@end
